<template>
  <div class="role-dashboard-wrapper">
    <component :is="currentComponent" />
  </div>
</template>
<script>
export default {
  name: 'RoleDashboard',
  components: {
    StudentDashboard: () => import('./student/StudentDashboard.vue'),
    TeacherDashboard: () => import('./teacher/TeacherDashboard.vue'),
    AdminDashboard: () => import('./admin/AdminDashboard.vue')
  },
  computed: {
    userType() { return this.$store.state.user.userType },
    currentComponent() {
      if (this.userType === 1) return 'StudentDashboard'
      if (this.userType === 2) return 'TeacherDashboard'
      if (this.userType === 3) return 'AdminDashboard'
      return { template: '<div style="padding:16px;">通用首页（未登录或未知角色）</div>' }
    }
  }
}
</script>
<style scoped>
.role-dashboard-wrapper {
  padding: 0;
}
</style>
